﻿<Controls:MetroWindow  
x:Class="PhilipsChannelOrder.Views.ChangeOrderView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:viewmodel="clr-namespace:PhilipsChannelOrder.ViewModels"
        Title="Philips Channel Order" Height="350" Width="525"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:Behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro"
    xmlns:cal="http://www.caliburnproject.org"
    Icon="..\philipstv.ico">
    
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary>

                </ResourceDictionary>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Orange.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <DockPanel Grid.Row="0">
            <Button x:Name="ReadXmlFile">Open</Button>
            <Button x:Name="SaveXmlFile">Save</Button>
            <Button x:Name="RemoveEmptyChannels">Remove Empty</Button>
            <TextBox></TextBox>

        </DockPanel>


        <ListBox Grid.Row="1" x:Name="ChannelMap" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Visible">
            <ListBox.ItemTemplate>
                <DataTemplate>

                    <DockPanel VerticalAlignment="Center" HorizontalAlignment="Left">
                        <TextBlock Width="30" Text="{Binding PresetNumber}" />
                        <TextBlock Width="200" Text="{Binding Name}" />
                        <Button ToolTip="Move to Up" Style="{DynamicResource MetroCircleButtonStyle}" Width="30" Height="30" cal:Message.Attach="ChannelUp($dataContext)">
                            <Canvas Width="76" Height="76"  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  >
                                <Canvas.LayoutTransform>
                                    <ScaleTransform ScaleY="0.3" ScaleX="0.3"/>
                                </Canvas.LayoutTransform>
                                <Path Width="28" Height="39.25" Canvas.Left="24" Canvas.Top="17.75" Stretch="Fill" Fill="#FF000000" Data="F1 M 34,57L 42,57L 42,32.25L 52,42.25L 52,31.75L 38,17.75L 24,31.75L 24,42.25L 34,32.25L 34,57 Z "/>
                            </Canvas>
                        </Button>
                        <Button ToolTip="Move down" Style="{DynamicResource MetroCircleButtonStyle}" Width="30" Height="30" cal:Message.Attach="ChannelDown($dataContext)">
                            <Canvas Width="76" Height="76"  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
                                <Canvas.LayoutTransform>
                                    <ScaleTransform ScaleY="-0.3" ScaleX="0.3"/>
                                </Canvas.LayoutTransform>
                                <Path Width="28" Height="39.25" Canvas.Left="24" Canvas.Top="17.75" Stretch="Fill" Fill="#FF000000" Data="F1 M 34,57L 42,57L 42,32.25L 52,42.25L 52,31.75L 38,17.75L 24,31.75L 24,42.25L 34,32.25L 34,57 Z "/>
                            </Canvas>
                        </Button>
                        <Button ToolTip="Move to end" Style="{DynamicResource MetroCircleButtonStyle}" Width="30" Height="30" cal:Message.Attach="MoveToEnd($dataContext)">
                            <Canvas Width="76" Height="76"  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
                                <Canvas.LayoutTransform>
                                    <ScaleTransform ScaleY="0.3" ScaleX="0.3"/>
                                </Canvas.LayoutTransform>
                                <Path Width="28" Height="39.25" Canvas.Left="24" Canvas.Top="17.75" Stretch="Fill" Fill="#FF000000" Data="F1 M 25,52L 51,52L 51,57L 25,57L 25,52 Z M 35,16L 41,16L 41,36.5L 49,27L 49,36.5L 38,49L 27,36.5L 27,27L 35,36.5L 35,16 Z "/>
                            </Canvas>
                        </Button>
                        <TextBox ToolTip="Set new position" cal:Message.Attach="UpdateOrder($dataContext, $this)" Text="{Binding PresetNumber}" AcceptsReturn="True"/>
                    </DockPanel>

                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

    </Grid>
</Controls:MetroWindow>
